import type { App } from 'vue';
import addTitleAtEllipsis from './add-title-at-ellipsis';
import reportView from './report-view';
import { LoadingDirective } from 'vue-devui/loading';
import { fileDropDirective } from 'vue-devui/upload';

// 注册到全局的指令
const GLOBAL_DIRECTIVES = {
  'add-title-at-ellipsis': addTitleAtEllipsis,
  'report-view': reportView,
  'loading': LoadingDirective,
  'file-drop': fileDropDirective
} as { [name: string]: object };

export default {
  install(app: App) {
    Object.keys(GLOBAL_DIRECTIVES).forEach((name: string) => {
      app.directive(name, GLOBAL_DIRECTIVES[name]);
    });
  }
};
